package com.zzh.ideas.web.config;

import com.zzh.ideas.web.framework.handler.RequestHandler;
import com.zzh.ideas.web.interceptor.SessionInteceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 拦截器配置
 *
 * @author chengbin
 */
@Configuration
public class InterceptorConfig extends WebMvcConfigurerAdapter {

    @Autowired
    private SessionInteceptor sessionInteceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
         registry.addInterceptor(new SessionInteceptor()).addPathPatterns("/**");
         registry.addInterceptor(new RequestHandler()).addPathPatterns("/**");
        super.addInterceptors(registry);
        // .excludePathPatterns("/login")
        // .excludePathPatterns("/main");
    }
}
